package taikai;

import java.util.ArrayList;

public class Team extends ArrayList<Person> implements TeamOrPlayer {

	private String name;

	public Team(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

    @Override
    public boolean add(Person e) {
        e.setTeam(this);
        return super.add(e);
    }

    @Override
    public boolean equals(Object o) {
        if(o.getClass()!=getClass()) {
            return false;
        }
        return name.equals(((Team)o).name);
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return name;
    }



}
